import {
    reqSearchList
} from '@/api'

const actions = {
    async getSearchList({
        commit
    }, data) {
        let result = await reqSearchList(data);
        if (result.code === 200) {
            commit('GET_SEARCH_LIST', result.data);
        }
    }
}

const mutations = {
    GET_SEARCH_LIST(state, value) {
        state.SearchList = value;
    }
}

const getters = {
    //商品信息
    goodsList() {
        return state.SearchList.goodsList;
    },
    //平台属性
    attrsList() {
        return state.SearchList.attrsList;
    },
    //品牌
    trademarkList() {
        return state.SearchList.trademarkList;
    },
    //商品数量
    total() {
        return state.SearchList.total;
    }
}

const state = {
    SearchList: {}
}

export default {
    actions,
    mutations,
    getters,
    state
}